Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
The compiler makes an error about a missing closing curly brace, but I can't see that ...
@inherits umbraco.MacroEngines.DynamicNodeContext @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = "SW_Master.cshtml"; string tagToFind = Request.QueryString["tag"]; var locations = Model.Content.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\""); } @if(tagToFind != null) { foreach (var node in locations) { string[] tags = @node.tags.ToString().Split(','); if (tags.Contains(tagToFind)) { @node.Url } } } else { <p>No tag!</p> }
I have Umbraco 6 :)
Best regardsKim
Hey Kim,
What about
@inherits umbraco.MacroEngines.DynamicNodeContext@inheritsUmbraco.Web.Mvc.UmbracoTemplatePage@{ Layout="SW_Master.cshtml"; string tagToFind =Request.QueryString["tag"]; var locations =Model.Content.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\""); if(tagToFind !=null){ foreach(var node in locations){ string[] tags =@node.tags.ToString().Split(','); if(tags.Contains(tagToFind)){@node.Url} } } else{<p>No tag!</p>} }
Hi Rich,
Thank you, but still the same error.
Could it be something else coursing the error? I'am not very found of this line:
var locations = Model.Content.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\"");
I'd comment out some lines until you find the error, or open in Visual Studio which should give you some visual clues
Rich
Thank you again! I have found the line that's makes the error!
@{ string tagToFind = Request.QueryString["tag"]; var locations = Model.Content.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\""); } @if(tagToFind != null) { foreach (var node in locations){ @* ------------------ This line is my problem: --------------------- *@ string[] tags = @node.tags.ToString().Split(','); if (tags.Contains(tagToFind)) { @node.Url } } }else { <p>No tag!</p> }
Have you tryed removing the @ infront of node
@{ string tagToFind =Request.QueryString["tag"]; var locations =Model.Content.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\"");}@if(tagToFind !=null){ foreach(var node in locations){ @*------------------ This line ismy problem:---------------------*@ string[] tags =node.tags.ToString().Split(','); if(tags.Contains(tagToFind)){ @node.Url } } }else{ <p>No tag!p>}
As Kim above says :)
It's a breaking change in v6 :-) http://issues.umbraco.org/issue/U4-1143#comment=67-4333
Jeroen
Great! Thank you all for your help!
Working code:
@{ string tagToFind = Request.QueryString["tag"]; var locations = Model.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\""); } @if(tagToFind != null) { foreach (var node in locations){ string[] tags = node.tags.ToString().Split(','); if (tags.Contains(tagToFind)) { @node.Url } } }else { <p>No tag!</p> }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Razor - missing '}' ?
Hi,
The compiler makes an error about a missing closing curly brace, but I can't see that ...
I have Umbraco 6 :)
Best regards
Kim
Hey Kim,
What about
Hi Rich,
Thank you, but still the same error.
Could it be something else coursing the error? I'am not very found of this line:
Best regards
Kim
Hey Kim,
I'd comment out some lines until you find the error, or open in Visual Studio which should give you some visual clues
Rich
Hi Rich,
Thank you again! I have found the line that's makes the error!
Have you tryed removing the @ infront of node
As Kim above says :)
It's a breaking change in v6 :-) http://issues.umbraco.org/issue/U4-1143#comment=67-4333
Jeroen
Great!
Thank you all for your help!
Working code:
Best regards
Kim
is working on a reply...